<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>TabView Example - Converting Modules to Tabs</title>
<link rel="stylesheet" type="text/css" href="css/example.css">

<link rel="stylesheet" type="text/css" href="../../build/tabview/assets/tabview.css">
<link rel="stylesheet" type="text/css" href="css/module_tabs.css">
<script type="text/javascript" src="../../build/yahoo/yahoo.js"></script>
<script type="text/javascript" src="../../build/event/event.js"></script>
<script type="text/javascript" src="../../build/dom/dom.js"></script>
<script type="text/javascript" src="../../build/tabview/tabview.js"></script>

<script type="text/javascript">
YAHOO.example.init = function() {
    var tabView = new YAHOO.widget.TabView();

    
    YAHOO.util.Event.onContentReady('top-stories', function() {
        var modules = YAHOO.util.Dom.getElementsByClassName('mod', 'div', this);
        
        YAHOO.util.Dom.batch(modules, function(module) {
            tabView.addTab( new YAHOO.widget.Tab({
                label: module.getElementsByTagName('h3')[0].innerHTML,
                contentEl: YAHOO.util.Dom.getElementsByClassName('bd', 
                        'div', module)[0]
            }));
            YAHOO.util.Dom.setStyle(module, 'display', 'none'); /* hide modules */
        });

        tabView.set('activeIndex', 0); // make first tab active
        tabView.appendTo(this); // append to "top-stories"
    });
};

YAHOO.example.init();
</script>

<style type="text/css">
#top-stories { width:45em; } /* arbitrary width */

#top-stories .yui-content {
    padding:1em;
}
</style>

</head>
<body>
<div id="doc">
    <h1>TabView Example - Converting Modules to Tabs</h1>
   <div id="top-stories">
      <h2>Top Stories</h2>
      <div class="mod">
         <div class="hd">
            <h3>Lorem</h3>
         </div>
         <div class="bd">
            <ul>
               <li><q><a href="#">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</a></q> <cite>Lorem</cite> - <strong>40 minutes ago</strong></li>

               <li><q><a href="#">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</a></q> <cite>Lorem</cite> - <strong>4 minutes ago</strong></li>
               <li><q><a href="#">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</a></q> <cite>Lorem</cite> - <strong>37 minutes ago</strong></li>
               <li><q><a href="#">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</a></q> <cite>Lorem</cite> - <strong>53 minutes ago</strong></li>

               <li><q><a href="#">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</a></q> <cite>Lorem</cite> - <strong>1 hour, 21 minutes ago</strong></li>
            </ul>
         </div>
      </div>
      
      <div class="mod">
         <div class="hd">
            <h3>Ipsum</h3>
         </div>
         <div class="bd">
            <ul>
               <li><q><a href="#">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</a></q> <cite>Ipsum</cite> - <strong>40 minutes ago</strong></li>

               <li><q><a href="#">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</a></q> <cite>Ipsum</cite> - <strong>4 minutes ago</strong></li>
               <li><q><a href="#">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</a></q> <cite>Ipsum</cite> - <strong>37 minutes ago</strong></li>
               <li><q><a href="#">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</a></q> <cite>Ipsum</cite> - <strong>53 minutes ago</strong></li>
            </ul>
         </div>
      </div>

      <div class="mod">
         <div class="hd">
            <h3>Dolor</h3>
         </div>
         <div class="bd">
            <ul>
               <li><q><a href="#">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</a></q> <cite>Dolor</cite> - <strong>40 minutes ago</strong></li>

               <li><q><a href="#">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</a></q> <cite>Dolor</cite> - <strong>4 minutes ago</strong></li>
               <li><q><a href="#">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</a></q> <cite>Dolor</cite> - <strong>37 minutes ago</strong></li>
               <li><q><a href="#">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</a></q> <cite>Dolor</cite> - <strong>53 minutes ago</strong></li>

               <li><q><a href="#">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</a></q> <cite>Dolor</cite> - <strong>1 hour, 21 minutes ago</strong></li>
            </ul>
         </div>
      </div>
</div>
</body>
</html>
